<template>
  <!-- 轮播图 -->
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
    <van-swipe-item v-for="item in swiperList" :key="item.id">
      <img :src="item.picUrl" alt="" />
    </van-swipe-item>
  </van-swipe>
</template>

<script>
import { reqHomeRecommend, reqHomeOther } from "@/api";
export default {
  name: "swiper",
  data() {
    return {
      swiperList: [], //轮播图数据
    };
  },
  methods: {
    //发请求获取轮播图数据
    async reqRecommend() {
      let result = await reqHomeRecommend();
      this.swiperList = result.data.data.focusList;
    },
  },
  mounted() {
    this.reqRecommend();
  },
};
</script>

<style lang="less" scoped>
//轮播图
.my-swipe {
  .van-swipe__track {
    height: 150px;
    .van-swipe-item {
      height: 150px;
    }
  }
  // 小圆点
  .van-swipe__indicators {
    bottom: 20px;
  }
  .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
    // background-color: #39a9ed;
    // background-image: ;
    // background-image: "./img/406009baa935f9bfbf04996519ca038e.webp";
    img {
      width: 375px;
      height: 150px;
    }
  }
}
</style>
